package twentyThreePattern.StructuralPattern7.proxy.DynamicProxy.section3;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;

public class DynamicProxy {
	@SuppressWarnings("unchecked")
	public static <T> T newInstance(ClassLoader loader, Class<?>[] interfaces, InvocationHandler h) {
		// 寻找JoinPoint连接点，AOP框架使用元数据定义
		if (true) {
			// 执行一个前置通知
			(new BeforeAdvice()).exec();
		}
		return (T) Proxy.newProxyInstance(loader, interfaces, h);
	}

}
